// 如果没有通过拦截器配置域名的话，可以在这里写上完整的URL(加上域名部分)
//const BASE_URL = "https://shop.lxkj.site/shop/api"

// 此处第二个参数vm，就是我们在页面使用的this，你可以通过vm获取vuex等操作，更多内容详见uView对拦截器的介绍部分：
// https://uviewui.com/js/http.html#%E4%BD%95%E8%B0%93%E8%AF%B7%E6%B1%82%E6%8B%A6%E6%88%AA%EF%BC%9F
const install = (Vue, vm) => {
	// 此为自定义拦截器配置参数，
	// 此为自定义拦截器配置参数，
	Vue.prototype.$u.http.setConfig({
		baseUrl: vm.$baseUrl
	});

	//-------------------------账户管理------------------------------------
	let miniWxLogin = (params = {}) => vm.$u.get('/Account/wxLogin', params); //微信授权登录
	let getHome = (params = {}) => vm.$u.get('/Parent/home', params); //首页
	let getPhone = (params = {}) => vm.$u.get('/Account/wxPhone', params); //微信授权登录
	let getBanner = (params = {}) => vm.$u.get('/Unit/plusBanner', params); //轮播图
	let getBannerDetail = (params = {}) => vm.$u.get('/Unit/plusBannerById', params); //轮播图详情
	let getTeachPage = (params = {}) => vm.$u.post('/Teacher/teacherVOPage', params, {
		'content-type': 'application/x-www-form-urlencoded'}); //获取教师分页
	let myInfo = (params = {}) => vm.$u.get('/Account/getMemberInfo', params); //个人账号信息
	let getCate = (params = {}) => vm.$u.get('/Unit/getCategoryList', params); //获取分类信息
	let getCity = (params = {}) => vm.$u.get('/Unit/getCityListInfo', params); //城市查询
	let getCateTree = (params = {}) => vm.$u.get('Unit/getCategoryTree', params); //获取分类信息
	let getQuyu = (params = {}) => vm.$u.get('Unit/getCountyListInfo', params); //区域查询
	let getTeacUnfo = (params = {}) => vm.$u.get('/Teacher/getTeacherVO', params); //老师详情
	let teacherImg = (params = {}) => vm.$u.get('/Account/createInvitePic', params); //生成老师信息图片
	let getFankui = (params = {}) => vm.$u.post('/CourseFeedback/getById', params, {
		'content-type': 'application/x-www-form-urlencoded'
	}); //反馈
	let getOrder = (params = {}) => vm.$u.post('/EducationOrder/orderVOPage', params, {
		'content-type': 'application/x-www-form-urlencoded'
	}); //订单分页
	let backClass = (params = {}) => vm.$u.get('/EducationOrderAfter/afterData', params); //退课数据
	let getTuike = (params = {}) => vm.$u.get('/EducationOrderAfter/createAfter', params); //退课申请
	let no = (params = {}) => vm.$u.get('/EducationOrder/noHire', params); //订单分页
	let getGing = (params = {}) => vm.$u.get('/Unit/areasTree', params); //定位城市
	let getHistory = (params = {}) => vm.$u.get('/Unit/searchList', params); //搜索历史记录
	let delHistory = (params = {}) => vm.$u.get('/Unit/delSearchList', params); //搜索历史记录
	let getNotice = (params = {}) => vm.$u.get('/Unit/myMessage', params); //通知
	let getNoticeNum = (params = {}) => vm.$u.get('/Unit/myMessageNum', params); //通知数量
	let updRead = (params = {}) => vm.$u.get('/Unit/updRead', params); //已读
	let delNum = (params = {}) => vm.$u.get('/Unit/delete', params); //删除
	let getOrderDetail = (params = {}) => vm.$u.get('/EducationOrder/getById', params); //订单详情
	let closeOrder = (params = {}) => vm.$u.get('/EducationOrderAfter/closeOrder', params); //订单关闭
	let kefu = (params = {}) => vm.$u.get('/Unit/dictItem', params); 
	let like = (params = {}) => vm.$u.post('/Collect/create', params, {
		'content-type': 'application/json'
	}); //收藏
	let fankui = (params = {}) => vm.$u.post('/Feedback/create', params, {
		'content-type': 'application/json'
	}); //取消收藏
	let delLike = (params = {}) => vm.$u.post('/Collect/cancel', params, {
		'content-type': 'application/json'
	}); //收藏
	let agreenTeacher = (params = {}) => vm.$u.post('/EducationOrder/choseTeacherDoPay', params, {
		'content-type': 'application/json'
	}); //同意老师
	let ruYOng = (params = {}) => vm.$u.post('/EducationOrder/createFormal', params, {
		'content-type': 'application/json'
	}); //录用订单
	let doPay = (params = {}) => vm.$u.post('/EducationOrder/doPay', params, {
		'content-type': 'application/json'
	}); //支付
	let updateInfo = (params = {}) => vm.$u.post('/Account/toUpdate', params, {
		'content-type': 'application/json'
	}); //完善资料
	let order = (params = {}) => vm.$u.post('/EducationOrder/create', params, {
		'content-type': 'application/json'
	}); //完善资料
	let getAreas = (params = {}) => vm.$u.get('/Unit/getAreas', params); 
	// 将各个定义的接口名称，统一放进对象挂载到vm.$u.api(因为vm就是this，也即this.$u.api)下
	vm.$u.api = {
		getAreas,
		getHistory,
		getTuike,
		getPhone,
		getBannerDetail,
		delNum,
		getTeachPage,
		fankui,
		updRead,
		delLike,
		getTeacUnfo,
		getBanner,
		kefu,
		teacherImg,
		getNoticeNum,
		order,
		backClass,
		getGing,
		no,
		getCate,
		delHistory,
		getCateTree,
		getOrder,
		miniWxLogin,
		myInfo,
		updateInfo,
		getNotice,
		getOrderDetail,
		closeOrder,
		getCity,
		getHome,
		like,
		doPay,
		agreenTeacher,
		getQuyu,
		getFankui,
		ruYOng
	};
}

export default {
	install
}